﻿<%@ Page Title="" Language="C#" MasterPageFile="HRMasterPage.master" AutoEventWireup="true"
    CodeFile="job-post.aspx.cs" Inherits="HR_job_post" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" > </cc1:ToolkitScriptManager>
    <div class="block">
    <div class="secondary-navigation">
                    <ul class="wat-cf">
                        <li class="active first"><a href="job-add-edit.aspx">Add new</a></li>
                    </ul>
                </div>
        <div class="content">
        <h2 class="title">Job Post List</h2>
            <div class="inner">
                <br />
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnClear" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                <asp:Panel ID="Panel1" runat="server" GroupingText="Search"  Width="390px">
                <div style="margin:10px;">
                <table>
                <tr>
                <td style="width:120px;">Job Title</td>
                <td>:</td>
                <td><asp:TextBox ID="txtJobTitle" runat="server" Width="200px"></asp:TextBox></td>
                </tr>
                <tr>
                <td>Created By</td>
                <td>:</td>
                <td><asp:TextBox ID="txtCreatedBy" runat="server" Width="200px"></asp:TextBox></td>
                </tr>
                <tr>
                <td>Created Date Range</td>
                <td>:</td>
                <td><asp:TextBox ID="txtStartDate" runat="server" Width="80px"></asp:TextBox>
                <cc1:CalendarExtender ID="txtStartDate_CalendarExtender" runat="server" 
            Enabled="True" TargetControlID="txtStartDate" Format="dd/MM/yyyy">
        </cc1:CalendarExtender>
         to <asp:TextBox ID="txtEndDate" runat="server" Width="80px"></asp:TextBox>
         <cc1:CalendarExtender ID="txtEndDate_CalendarExtender" runat="server" 
            Enabled="True" TargetControlID="txtEndDate" Format="dd/MM/yyyy">
        </cc1:CalendarExtender>
        <br />
        <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="CompareValidator" 
                        ControlToCompare="txtStartDate" ControlToValidate="txtEndDate" Type="Date"
                        Operator="GreaterThan">*End Date must greater than Start Date</asp:CompareValidator>
        </td>
                </tr>
                <tr>
                <td>Status</td>
                <td>:</td>
                <td><asp:DropDownList
                        ID="ddlStatus" runat="server">
                        <asp:ListItem Value="true">Visible</asp:ListItem>
                        <asp:ListItem Value="false">Hidden</asp:ListItem>
                    </asp:DropDownList>
                </td>
                </tr>
                <tr>
                <td></td>
                <td></td>
                <td><asp:Button ID="btnSearch" runat="server" Text="Search" 
                        onclick="btnSearch_Click" Width="80px" Height="30px" />
                         &nbsp;<asp:Button ID="btnClear" runat="server" Text="Clear" 
                        Width="80px" Height="30px" onclick="btnClear_Click" /></td>
                </tr>
                </table>
                    
                    </div>
                </asp:Panel>
                </ContentTemplate>
                </asp:UpdatePanel>
                <br /><br />
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                <asp:Label ID="lblCurrpageTop" runat="server"></asp:Label>
                <asp:GridView ID="gvJob" runat="server" AutoGenerateColumns="false" OnRowCommand="gvJob_RowCommand"
                    CssClass="table" AlternatingRowStyle-CssClass="even"
                    RowStyle-CssClass="odd" GridLines="None" 
                    onrowdatabound="gvJob_RowDataBound">
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="JobTitle" HeaderText="Job Title" />
                        <asp:TemplateField SortExpression="Status" HeaderText="Status">
                            <ItemTemplate>
                                <asp:Label ID="lblStatus" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Status") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="EndDate" HeaderText="End Date" DataFormatString="{0:dd/MMM/yyyy}" />
                        <asp:TemplateField SortExpression="CreatedBy" HeaderText="Created By" ItemStyle-Width="70px">
                            <ItemTemplate>
                                <asp:Label ID="lblCreatedBy" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CreatedBy") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="CreatedDate" HeaderText="Created Date" ItemStyle-Width="80px" />
                        <asp:TemplateField ItemStyle-Width="120px">
                            <ItemTemplate>
                            <a href='<%# "job-preview.aspx?jid=" +  DataBinder.Eval(Container.DataItem, "JobID") %>'
                                        target="_blank">Preview</a> | 
                                <a href='<%# "job-add-edit.aspx?jid=" +  DataBinder.Eval(Container.DataItem, "JobID") %>'>
                                    Edit</a> | <asp:LinkButton ID="lkDelete" runat="server" OnClientClick="return confirm('Confirm to delete this job post?');"
                                    CommandName="DeleteJob" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "JobID") %>'>Delete</asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
                <asp:Label ID="lblCurrpage" runat="server"></asp:Label>
                </ContentTemplate>
                </asp:UpdatePanel>
                <asp:HiddenField ID="hidJobTitle" runat="server" />
                <asp:HiddenField ID="hidCreatedBy" runat="server" />
                <asp:HiddenField ID="hidStartDate" runat="server" />
                <asp:HiddenField ID="hidEndDate" runat="server" />
                <asp:HiddenField ID="hidStatus" runat="server" Value="true" />
            </div>
        </div>
    </div>
</asp:Content>
